﻿using System;

namespace SMARTMobile.WinPhone
{
    public class WebServiceResult<T>
    {
        public bool IsSuccessful { get; private set; }
        public T Result { get; private set; }
        public Exception Exception { get; private set; }

        public WebServiceResult(T result)
        {
            IsSuccessful = true;
            Result = result;
        }

        public WebServiceResult(Exception exception)
        {
            IsSuccessful = false;
            Exception = exception;
        }

        public override string ToString()
        {
            return string.Format("{0}\r\n{1}", IsSuccessful, (IsSuccessful) ? Result.ToString() : Exception.ToString());
        }
    }
}
